/* Copyright 2017, 2018, 2019, 2020 Gabriel Czernikier
 *
 * This file is part of Côtehaus.
 * Côtehaus is free software: you can redistribute it and/or modify
 * it under the terms of one of the following:
 * 1. The same dual license as that of Côtehaus itself, of which individual licenses are
 * the MIT License and the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 2. The MIT License.
 * 3. The GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * Côtehaus is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * MIT License and the GNU General Public License for more details.
 * You should have received a copy of the MIT License and the GNU General Public License
 * along with Côtehaus.  If not, see <https://opensource.org/licenses/MIT> and <http://www.gnu.org/licenses/>.
 */
#ifndef __CH_PARSE_FILE_H
#define __CH_PARSE_FILE_H
#include<stdbool.h>
#include "types.h"

extern bool PARSING_EXTERN_DECL;

// A list of tokens related by position, transversable from latter to earlier, eg. "String" -> "lang" -> "java", and "Entry" -> "Map" -> "util" -> "java"
// This is the representation of the RefTyp_group as it appears in the outline, pseudo code, above.
struct token_list_st {
	lgwseq_t *token;
	struct list_head token_list;  // For instance, a reference to "java.lang.String" will give rise to "String" as the token, "lang" as the preceeding_token's token, "java" as the next prefix in the chain, which will have NULL as preceeding_token.
};

struct token_list_st *token_list(lgwseq_t *token, struct token_list_st *preceeding);
bool token_list_st_equals(struct token_list_st *a, struct token_list_st *b);
lgwseq_t *strpartcatsep(struct token_list_st *particles, lgwseq_t  *separator);

void
parse_file(const char *fname);
int
yylex(void);
void
yyerror (char const *s);

#endif
